/* /////////////////////////////////////////////////////////////////////////////
//
//                  INTEL CORPORATION PROPRIETARY INFORMATION
//     This software is supplied under the terms of a license agreement or
//     nondisclosure agreement with Intel Corporation and may not be copied
//     or disclosed except in accordance with the terms of that agreement.
//          Copyright(c) 2004-2007 Intel Corporation. All Rights Reserved.
//
//
//          VC-1 (VC1) decoder, DC Difference tables
//
*/
#include "umc_defs.h"

#if defined (UMC_ENABLE_VC1_VIDEO_DECODER) || defined (UMC_ENABLE_VC1_SPLITTER) || defined (UMC_ENABLE_VC1_VIDEO_ENCODER)

#include "umc_vc1_common_defs.h"
#include "umc_vc1_common_dc_tbl.h"

//VC-1 Table 174: Low-motion Luma DC Differential VLC Table
//////////////////////////////////////////////////////////////////////////////
//DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size
//    0    1        1       40       151        14      80     197608     23
//    1    1        2       41       384        14      81     197609     23
//    2    1        4       42       788        15      82     197610     23
//    3    1        5       43       789        15      83     197611     23
//    4    5        5       44       1541       16      84     197612     23
//    5    7        5       45       1540       16      85     197613     23
//    6    8        6       46       1542       16      86     197614     23
//    7    12       6       47       3086       17      87     197615     23
//    8    0        7       48       197581     23      88     197616     23
//    9    2        7       49       197577     23      89     197617     23
//    10   18       7       50       197576     23      90     197618     23
//    11   26       7       51       197578     23      91     197619     23
//    12   3        8       52       197579     23      92     197620     23
//    13   7        8       53       197580     23      93     197621     23
//    14   39       8       54       197582     23      94     197622     23
//    15   55       8       55       197583     23      95     197623     23
//    16   5        9       56       197584     23      96     197624     23
//    17   76       9       57       197585     23      97     197625     23
//    18   108      9       58       197586     23      98     197626     23
//    19   109      9       59       197587     23      99     197627     23
//    20   8        10      60       197588     23      100    197628     23
//    21   25       10      61       197589     23      101    197629     23
//    22   155      10      62       197590     23      102    197630     23
//    23   27       10      63       197591     23      103    197631     23
//    24   154      10      64       197592     23      104    395136     24
//    25   19       11      65       197593     23      105    395137     24
//    26   52       11      66       197594     23      106    395138     24
//    27   53       11      67       197595     23      107    395139     24
//    28   97       12      68       197596     23      108    395140     24
//    29   72       13      69       197597     23      109    395141     24
//    30   196      13      70       197598     23      110    395142     24
//    31   74       13      71       197599     23      111    395143     24
//    32   198      13      72       197600     23      112    395144     24
//    33   199      13      73       197601     23      113    395145     24
//    34   146      14      74       197602     23      114    395146     24
//    35   395      14      75       197603     23      115    395147     24
//    36   147      14      76       197604     23      116    395148     24
//    37   387      14      77       197605     23      117    395149     24
//    38   386      14      78       197606     23      118    395150     24
//    39   150      14      79       197607     23      ESCAPE 395151     24
//////////////////////////////////////////////////////////////////////////////


const extern Ipp32s VC1_LowMotionLumaDCDiff[] =
{
 24, /* max bits */
 4,  /* total subtables */
 6,6,5,7 ,/* subtable sizes */

 1, /* 1-bit codes */
     1, 0,
 1, /* 2-bit codes */
    1, 1,
 0, /* 3-bit codes */
 1, /* 4-bit codes */
    1, 2,
 3, /* 5-bit codes */
    1, 3,    5, 4,    7, 5,
 2, /* 6-bit codes */
    8, 6,    12, 7,
 4,/* 7-bit codes */
    0, 8,    2, 9,    18,10,    26,11,
 4, /* 8-bit codes */
    3, 12,    7, 13,    39, 14,   55,15,
 4,/* 9-bit codes */
    5, 16,    76, 17,   108, 18,  109, 19,
 5, /* 10-bit codes */
    8, 20,    25, 21,   155,22,   27,23,     154,24,
 3, /* 11-bit codes */
    19, 25,   52, 26,   53, 27,

 1, /* 12-bit codes */
    97, 28,
 5, /* 13-bit codes */
    72, 29,   196, 30,  74, 31,   198, 32,   199, 33,
 8, /* 14-bit codes */
    146, 34,  395, 35,  147, 36,  387, 37,
    386, 38,  150, 39,  151, 40,  384, 41,
 2, /* 15-bit codes */
    788, 42,    789, 43,
 3, /* 16-bit codes */
    1541, 44,    1540, 45,    1542, 46,
 1, /* 17-bit codes */
    3086, 47,
 0, /* 18-bit codes */
 0, /* 19-bit codes */
 0, /* 20-bit codes */
 0, /* 21-bit codes */
 0, /* 22-bit codes */
 56, /* 23-bit codes */
    197581, 48,   197577, 49,   197576, 50,   197578, 51,
    197579, 52,   197580, 53,   197582, 54,   197583, 55,
    197584, 56,   197585, 57,   197586, 58,   197587, 59,
    197588, 60,   197589, 61,   197590, 62,   197591, 63,
    197592, 64,   197593, 65,   197594, 66,   197595, 67,
    197596, 68,   197597, 69,   197598, 70,   197599, 71,
    197600, 72,   197601, 73,   197602, 74,   197603, 75,
    197604, 76,   197605, 77,   197606, 78,   197607, 79,
    197608, 80,   197609, 81,   197610, 82,   197611, 83,
    197612, 84,   197613, 85,   197614, 86,   197615, 87,
    197616, 88,   197617, 89,   197618, 90,   197619, 91,
    197620, 92,   197621, 93,   197622, 94,   197623, 95,
    197624, 96,   197625, 97,   197626, 98,   197627, 99,
    197628, 100,  197629, 101,  197630, 102,  197631, 103,

16, /* 24-bit codes */
    395136, 104,  395137, 105,  395138, 106,  395139, 107,
    395140, 108,  395141, 109,  395142, 110,  395143, 111,
    395144, 112,  395145, 113,  395146, 114,  395147, 115,
    395148, 116,  395149, 117,  395150, 118,  395151, IPPVC_ESCAPE,

-1 /* end of table */
};

//VC-1 Table 175: Low-motion Chroma DC Differential VLC Table
//////////////////////////////////////////////////////////////////////////////
//DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size
//    0    0        2        40     1630      11        80    3163240    22
//    1    1        2        41     3256      12        81    3163241    22
//    2    5        3        42     3088      12        82    3163242    22
//    3    9        4        43     3257      12        83    3163243    22
//    4    13       4        44     6179      13        84    3163244    22
//    5    17       5        45     12357     14        85    3163245    22
//    6    29       5        46     24713     15        86    3163246    22
//    7    31       5        47     49424     16        87    3163247    22
//    8    33       6        48     3163208   22        88    3163248    22
//    9    49       6        49     3163209   22        89    3163249    22
//    10   56       6        50     3163210   22        90    3163250    22
//    11   51       6        51     3163211   22        91    3163251    22
//    12   57       6        52     3163212   22        92    3163252    22
//    13   61       6        53     3163213   22        93    3163253    22
//    14   97       7        54     3163214   22        94    3163254    22
//    15   121      7        55     3163215   22        95    3163255    22
//    16   128      8        56     3163216   22        96    3163256    22
//    17   200      8        57     3163217   22        97    3163257    22
//    18   202      8        58     3163218   22        98    3163258    22
//    19   240      8        59     3163219   22        99    3163259    22
//    20   129      8        60     3163220   22        100   3163260    22
//    21   192      8        61     3163221   22        101   3163261    22
//    22   201      8        62     3163222   22        102   3163262    22
//    23   263      9        63     3163223   22        103   3163263    22
//    24   262      9        64     3163224   22        104   6326400    23
//    25   406      9        65     3163225   22        105   6326401    23
//    26   387      9        66     3163226   22        106   6326402    23
//    27   483      9        67     3163227   22        107   6326403    23
//    28   482      9        68     3163228   22        108   6326404    23
//    29   522      10       69     3163229   22        109   6326405    23
//    30   523      10       70     3163230   22        110   6326406    23
//    31   1545     11       71     3163231   22        111   6326407    23
//    32   1042     11       72     3163232   22        112   6326408    23
//    33   1043     11       73     3163233   22        113   6326409    23
//    34   1547     11       74     3163234   22        114   6326410    23
//    35   1041     11       75     3163235   22        115   6326411    23
//    36   1546     11       76     3163236   22        116   6326412    23
//    37   1631     11       77     3163237   22        117   6326413    23
//    38   1040     11       78     3163238   22        118   6326414    23
//    39   1629     11       79     3163239   22       ESCAPE 6326415    23
/////////////////////////////////////////////////////////////////////////////

const extern Ipp32s VC1_LowMotionChromaDCDiff[] =
{
 23, /* max bits */
 4,  /* total subtables */
 6,6,4,7 ,/* subtable sizes */

 0, /* 1-bit codes */
 2, /* 2-bit codes */
     0, 0,    1, 1,

 1, /* 3-bit codes */
    5, 2,

 2, /* 4-bit codes */
    9, 3,    13, 4,

 3, /* 5-bit codes */
     17, 5,  29, 6,    31, 7,

 6, /* 6-bit codes */
     33, 8,  49, 9,   56, 10,    51, 11,
     57, 12, 61, 13,

 2,/* 7-bit codes */
     97, 14, 121, 15,

 7, /* 8-bit codes */
     128, 16,  200, 17,   202, 18,   240, 19,
     129, 20,  192, 21,   201, 22,

 6,/* 9-bit codes */
     263, 23,  262, 24,   406, 25,   387, 26,
     483, 27,  482, 28,

 2, /* 10-bit codes */
     522, 29,    523, 30,

 10, /* 11-bit codes */
     1545, 31,   1042, 32,   1043, 33,   1547, 34,
     1041, 35,   1546, 36,   1631, 37,   1040, 38,
     1629, 39,   1630, 40,

 3, /* 12-bit codes */
     3256, 41,   3088, 42,   3257, 43,

 1, /* 13-bit codes */
     6179, 44,

 1, /* 14-bit codes */
     12357, 45,

 1, /* 15-bit codes */
    24713, 46,

 1, /* 16-bit codes */
    49424, 47,
 0, /* 17-bit codes */
 0, /* 18-bit codes */
 0, /* 19-bit codes */
 0, /* 20-bit codes */
 0, /* 21-bit codes */
 56, /* 22-bit codes */
    3163208, 48,    3163209, 49,   3163210, 50,   3163211, 51,
    3163212, 52,    3163213, 53,   3163214, 54,   3163215, 55,
    3163216, 56,    3163217, 57,   3163218, 58,   3163219, 59,
    3163220, 60,    3163221, 61,   3163222, 62,   3163223, 63,

    3163224, 64,    3163225, 65,   3163226, 66,   3163227, 67,
    3163228, 68,    3163229, 69,   3163230, 70,   3163231, 71,
    3163232, 72,    3163233, 73,   3163234, 74,   3163235, 75,
    3163236, 76,    3163237, 77,   3163238, 78,   3163239, 79,

    3163240, 80,    3163241, 81,   3163242, 82,   3163243, 83,
    3163244, 84,    3163245, 85,   3163246, 86,   3163247, 87,
    3163248, 88,    3163249, 89,   3163250, 90,   3163251, 91,
    3163252, 92,    3163253, 93,   3163254, 94,   3163255, 95,

    3163256, 96,    3163257, 97,   3163258, 98,   3163259, 99,
    3163260, 100,   3163261, 101,  3163262, 102,  3163263, 103,

 16, /* 23-bit codes */
    6326400, 104,   6326401, 105,  6326402, 106,  6326403, 107,
    6326404, 108,   6326405, 109,  6326406, 110,  6326407, 111,
    6326408, 112,   6326409, 113,  6326410, 114,  6326411, 115,
    6326412, 116,   6326413, 117,  6326414, 118,  6326415, IPPVC_ESCAPE,

-1 /* end of table */
};

//VC-1 Table 176: High-motion Luma DC Differential VLC Table
//DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size
//0       2         2         40    824      12         80    1993024      26
//1       3         2         41    829      12         81    1993025      26
//2       3         3         42    171      13         82    1993026      26
//3       2         4         43    241      13         83    1993027      26
//4       5         4         44    1656     13         84    1993028      26
//5       1         5         45    242      13         85    1993029      26
//6       3         5         46    480      14         86    1993030      26
//7       8         5         47    481      14         87    1993031      26
//8       0         6         48    340      14         88    1993032      26
//9       5         6         49    3314     14         89    1993033      26
//10      13        6         50    972      15         90    1993034      26
//11      15        6         51    683      15         91    1993035      26
//12      19        6         52    6631     15         92    1993036      26
//13      8         7         53    974      15         93    1993037      26
//14      24        7         54    6630     15         94    1993038      26
//15      28        7         55    1364     16         95    1993039      26
//16      36        7         56    1951     16         96    1993040      26
//17      4         8         57    1365     16         97    1993041      26
//18      6         8         58    3901     17         98    1993042      26
//19      18        8         59    3895     17         99    1993043      26
//20      50        8         60    3900     17         100   1993044      26
//21      59        8         61    3893     17         101   1993045      26
//22      74        8         62    7789     18         102   1993046      26
//23      75        8         63    7784     18         103   1993047      26
//24      11        9         64    15576    19         104   1993048      26
//25      38        9         65    15571    19         105   1993049      26
//26      39        9         66    15577    19         106   1993050      26
//27      102       9         67    31140    20         107   1993051      26
//28      116       9         68    996538   25         108   1993052      26
//29      117       9         69    996532   25         109   1993053      26
//30      20        10        70    996533   25         110   1993054      26
//31      28        10        71    996534   25         111   1993055      26
//32      31        10        72    996535   25         112   1993056      26
//33      29        10        73    996536   25         113   1993057      26
//34      43        11        74    996537   25         114   1993058      26
//35      61        11        75    996539   25         115   1993059      26
//36      413       11        76    996540   25         116   1993060      26
//37      415       11        77    996541   25         117   1993061      26
//38      84        12        78    996542   25         118   1993062      26
//39      825       12        79    996543   25         ESC   1993063      26

const extern Ipp32s VC1_HighMotionLumaDCDiff[] =
{
 26, /* max bits */
 4,  /* total subtables */
 6,6,6,8 ,/* subtable sizes */

 0, /* 1-bit codes */
 2, /* 2-bit codes */
    2, 0 ,     3, 1 ,

 1, /* 3-bit codes */
    3, 2,

 2, /* 4-bit codes */
    2, 3,    5, 4,

 3, /* 5-bit codes */
    1, 5,    3, 6,    8, 7,

 5, /* 6-bit codes */
    0, 8,    5, 9,    13, 10,    15, 11,
    19, 12,

 4,/* 7-bit codes */
    8, 13,   24, 14,  28, 15,    36, 16,

 7, /* 8-bit codes */
    4, 17,   6, 18,   18, 19,    50, 20,
    59, 21,  74, 22,  75, 23,

 6,/* 9-bit codes */
    11, 24,    38, 25,    39, 26,    102, 27,
    116, 28,   117, 29,

 4, /* 10-bit codes */
    20, 30,    28, 31,    31, 32,    29, 33,


 4, /* 11-bit codes */
    43, 34,    61, 35,    413, 36,   415, 37,

 4, /* 12-bit codes */
    84, 38,    825, 39,   824, 40,   829, 41,

 4, /* 13-bit codes */
    171, 42,   241, 43,   1656, 44,  242, 45,

 4, /* 14-bit codes */
    480, 46,   481, 47,   340, 48,   3314, 49,

 5, /* 15-bit codes */
    972, 50,   683, 51,   6631, 52,  974, 53,
    6630, 54,

 3, /* 16-bit codes */
    1364, 55,  1951, 56,  1365, 57,

 4, /* 17-bit codes */
    3901, 58,  3895, 59,  3900, 60,  3893, 61,

 2, /* 18-bit codes */
    7789, 62,  7784, 63,

 3, /* 19-bit codes */
    15576, 64, 15571, 65, 15577, 66,

 1, /* 20-bit codes */
    31140, 67,

 0, /* 21-bit codes */
 0, /* 22-bit codes */
 0, /* 23-bit codes */
 0, /* 24-bit codes */
 12, /* 25-bit codes */
    996538, 68,    996532, 69,    996533, 70,    996534, 71,
    996535, 72,    996536, 73,    996537, 74,    996539, 75,
    996540, 76,    996541, 77,    996542, 78,    996543, 79,

 40, /* 26-bit codes */
    1993024, 80,   1993025, 81,   1993026, 82,   1993027, 83,
    1993028, 84,   1993029, 85,   1993030, 86,   1993031, 87,
    1993032, 88,   1993033, 89,   1993034, 90,   1993035, 91,
    1993036, 92,   1993037, 93,   1993038, 94,   1993039, 95,
    1993040, 96,   1993041, 97,   1993042, 98,   1993043, 99,
    1993044, 100,  1993045, 101,  1993046, 102,  1993047, 103,
    1993048, 104,  1993049, 105,  1993050, 106,  1993051, 107,
    1993052, 108,  1993053, 109,  1993054, 110,  1993055, 111,
    1993056, 112,  1993057, 113,  1993058, 114,  1993059, 115,
    1993060, 116,  1993061, 117,  1993062, 118,  1993063, IPPVC_ESCAPE,

-1 /* end of table */
};

//VC-1 Table 177: High-motion Chroma DC Differential VLC Table
//DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size DC Diff VLC Code VLC Size
//0       0          2      40        51124       16    80    13087336    24
//1       1          2      41        51125       16    81    13087337    24
//2       4          3      42        25566       15    82    13087338    24
//3       7          3      43        51127       16    83    13087339    24
//4       11         4      44        51128       16    84    13087340    24
//5       13         4      45        51129       16    85    13087341    24
//6       21         5      46        102245      17    86    13087342    24
//7       40         6      47        204488      18    87    13087343    24
//8       48         6      48        13087304    24    88    13087344    24
//9       50         6      49        13087305    24    89    13087345    24
//10      82         7      50        13087306    24    90    13087346    24
//11      98         7      51        13087307    24    91    13087347    24
//12      102        7      52        13087308    24    92    13087348    24
//13      166        8      53        13087309    24    93    13087349    24
//14      198        8      54        13087310    24    94    13087350    24
//15      207        8      55        13087311    24    95    13087351    24
//16      335        9      56        13087312    24    96    13087352    24
//17      398        9      57        13087313    24    97    13087353    24
//18      412        9      58        13087314    24    98    13087354    24
//19      669        10     59        13087315    24    99    13087355    24
//20      826        10     60        13087316    24    100   13087356    24
//21      1336       11     61        13087317    24    101   13087357    24
//22      1596       11     62        13087318    24    102   13087358    24
//23      1598       11     63        13087319    24    103   13087359    24
//24      1599       11     64        13087320    24    104   26174592    25
//25      1654       11     65        13087321    24    105   26174593    25
//26      2675       12     66        13087322    24    106   26174594    25
//27      3194       12     67        13087323    24    107   26174595    25
//28      3311       12     68        13087324    24    108   26174596    25
//29      5349       13     69        13087325    24    109   26174597    25
//30      6621       13     70        13087326    24    110   26174598    25
//31      10696      14     71        13087327    24    111   26174599    25
//32      10697      14     72        13087328    24    112   26174600    25
//33      25565      15     73        13087329    24    113   26174601    25
//34      13240      14     74        13087330    24    114   26174602    25
//35      13241      14     75        13087331    24    115   26174603    25
//36      51126      16     76        13087332    24    116   26174604    25
//37      25560      15     77        13087333    24    117   26174605    25
//38      25567      15     78        13087334    24    118   26174606    25
//39      51123      16     79        13087335    24    ESC   26174607    25


const extern Ipp32s VC1_HighMotionChromaDCDiff[] =
{
 25, /* max bits */
 4,  /* total subtables */
 6,6,6,7 ,/* subtable sizes */

 0, /* 1-bit codes */
 2, /* 2-bit codes */
    0, 0,    1, 1,

 2, /* 3-bit codes */
    4, 2,    7, 3,

 2, /* 4-bit codes */
    11, 4,    13, 5,

 1, /* 5-bit codes */
    21, 6,

 3, /* 6-bit codes */
    40, 7,    48, 8,    50, 9,

 3,/* 7-bit codes */
    82, 10,   98, 11,   102, 12,

 3, /* 8-bit codes */
    166, 13,  198, 14,  207, 15,

 3,/* 9-bit codes */
    335, 16,  398, 17,  412, 18,

 2, /* 10-bit codes */
    669, 19,  826, 20,

 5, /* 11-bit codes */
    1336, 21, 1596, 22, 1598, 23,   1599, 24,
    1654, 25,

 3, /* 12-bit codes */
    2675, 26, 3194, 27, 3311, 28,

 2, /* 13-bit codes */
    5349, 29, 6621, 30,

 4, /* 14-bit codes */
    10696, 31,  10697, 32, 13240, 34,  13241, 35,

 4, /* 15-bit codes */
    25560, 37,  25565, 33, 25566, 42,  25567, 38,

 7, /* 16-bit codes */
    51123, 39,  51124, 40, 51125, 41,  51126, 36,
    51127, 43,  51128, 44, 51129, 45,

 1, /* 17-bit codes */
    102245, 46,

 1, /* 18-bit codes */
    204488, 47,

 0, /* 19-bit codes */
 0, /* 20-bit codes */
 0, /* 21-bit codes */
 0, /* 22-bit codes */
 0, /* 23-bit codes */
 56, /* 24-bit codes */
    13087304, 48,    13087305, 49,    13087306, 50,    13087307, 51,
    13087308, 52,    13087309, 53,    13087310, 54,    13087311, 55,
    13087312, 56,    13087313, 57,    13087314, 58,    13087315, 59,
    13087316, 60,    13087317, 61,    13087318, 62,    13087319, 63,
    13087320, 64,    13087321, 65,    13087322, 66,    13087323, 67,
    13087324, 68,    13087325, 69,    13087326, 70,    13087327, 71,
    13087328, 72,    13087329, 73,    13087330, 74,    13087331, 75,
    13087332, 76,    13087333, 77,    13087334, 78,    13087335, 79,
    13087336, 80,    13087337, 81,    13087338, 82,    13087339, 83,
    13087340, 84,    13087341, 85,    13087342, 86,    13087343, 87,
    13087344, 88,    13087345, 89,    13087346, 90,    13087347, 91,
    13087348, 92,    13087349, 93,    13087350, 94,    13087351, 95,
    13087352, 96,    13087353, 97,    13087354, 98,    13087355, 99,
    13087356, 100,   13087357, 101,   13087358, 102,   13087359, 103,

 16, /* 25-bit codes */
    26174592, 104,   26174593, 105,   26174594, 106,   26174595, 107,
    26174596, 108,   26174597, 109,   26174598, 110,   26174599, 111,
    26174600, 112,   26174601, 113,   26174602, 114,   26174603, 115,
    26174604, 116,   26174605, 117,   26174606, 118,   26174607, IPPVC_ESCAPE,
-1 /* end of table */
};

#endif //UMC_ENABLE_VC1_VIDEO_DECODER
